package initialize

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"zg3zhoukao/config"
)

var (
	Rdb *redis.Client
)

func Redis() {
	appconf := config.Conf.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     appconf.Addr,
		Password: appconf.Password,
		DB:       appconf.DB,
	})
	_, err = Rdb.Ping(context.Background()).Result()
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println("redis初始化成功")
}
